# s='hello\nworld'
# with open('txt.txt','w') as f:
#     f.write(s)

with open('txt.txt',) as f:
    print(f.read())
print('---------------')
with open('txt.txt',) as f:
    data_list = f.readlines()
    for i in data_list:
        print(i)
print('--------------------')
with open('txt.txt',) as f:
    while True:
        line = f.readline()
        if line:
            print(line)
        else:
            break
